from selenium import webdriver
from selenium.webdriver.edge.options import Options
import time

# 设置浏览器、启动浏览器
def create_driver():
    options = Options()
    options.add_argument('--no-sandbox')
    options.add_experimental_option("detach", True)
    driver_edge = webdriver.Edge(options=options)
    return driver_edge
driver = create_driver()

# 打开指定网址
driver.get("https://baidu.com")
# 浏览器截图
driver.get_screenshot_as_file("screenshot.png")
time.sleep(3)
# 刷新当前网页
driver.refresh()




